//
//  FCTxtChoiceRightBtnTableViewCell.m
//  AFNetworking
//
//  Created by WJC on 2020/1/19.
//

#import "FCTxtChoiceRightBtnTableViewCell.h"
#import "WJCDefine.h"
#import "Masonry.h"
@implementation FCTxtChoiceRightBtnTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier setLeftImg:(BOOL)leftImg{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(16, 12, 150, 20)];
        self.titleLabel.font=font15;
        self.titleLabel.textColor=HEXC(0x232323);
       
        self.detailLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.titleLabel.frame.origin.x+self.titleLabel.frame.size.width+16, 12, WJCScreenW-(self.titleLabel.frame.origin.x+self.titleLabel.frame.size.width+32), 20)];

        self.detailLabel.font=font15;
        self.detailLabel.textColor=HEXC(0x646262);
         self.detailLabel.textAlignment=NSTextAlignmentRight;
        self.titleLabel.text=@"";
        self.detailLabel.text=@"";
        [self.contentView addSubview: self.titleLabel];
        [self.contentView addSubview: self.detailLabel];
        if (leftImg) {
             self.leftImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
                   [self.contentView addSubview:self.leftImage];
            [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(16);
                make.centerY.mas_equalTo(0);
                make.width.and.height.mas_equalTo(32);
            }];
        }
       
        self.checkBtn=[UIButton buttonWithType:UIButtonTypeCustom];
        [self.checkBtn setImage:[UIImage imageNamed:@"message_checkbox_default"]forState:UIControlStateNormal];
        [self.checkBtn setImage:[UIImage imageNamed:@"message_checkbox_selected"] forState:UIControlStateSelected];
        [self.contentView addSubview:self.checkBtn];
        WJCWeakSelf
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            if(leftImg){
                make.left.equalTo(weakSelf.leftImage.mas_right).mas_offset(8);
            }else{
            make.left.mas_equalTo(16);
            }
            make.centerY.mas_equalTo(0);
        }];
        [self.checkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(0);
            make.right.mas_equalTo(-16);
            make.width.and.height.mas_equalTo(24);
        }];
//        self.checkBtn.hidden = YES;
        [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(0);
            make.right.equalTo(self.checkBtn.mas_left).mas_offset(-8);
        }];
    }
    return self;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
